package com.tensquare.search.controller;

import com.tensquare.search.pojo.Article;
import com.tensquare.search.service.ArticleService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by WF on 2020/4/1 15:12
 */
@RestController
@RequestMapping("article")
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    //1.添加文章
    @PostMapping
    public Result add(@RequestBody Article article){
        //1.1)添加文章
        articleService.add(article);
        //1.2)返回
        return new Result(true,StatusCode.OK,"添加文章成功！");
    }
}
